Two column template (incremental)

  • Some text
  • Some text

Scripted Data Workflow




%%{ init: {
    'themeVariables':
        { 'fontSize': '30px'}
} }%%

flowchart LR
  A(Import) --> B(Tidy)
  B --> C(Transform)
  C --> D(Visualize)
  D --> E(Analyze)
  E --> F(Communicate)
  F --> G(Preserve)
  G --> A
  
style A fill:#FFFF00,stroke:#333,stroke-width:4px

Analysis

Analysis

Criteria for Best Practice

  • The steps are clear
  • The workflow is reproducible
  • Limited opportunities for human error

Analysis: Manual Workflow

Steps

  1. Reformat data
  2. Load data into software (PRESENCE, Mark, Distance, etc.)
  3. Use interface to select options
  4. Run it
  5. Export results

Analysis: Manual Workflow

Limitations

  • Restricted to functions in the software
  • “Black Box”
  • Difficult/time-consuming to document and reproduce steps
  • Must extract results into another software to visualize

Analysis: R Workflow

Advantages

  • Many custom R packages for performing most common ecological data analyses
    • 21,477 1 R packages available to download
    • There’s probably an R package that does what you need!
  • R packages are generally well-documented
  • Your code documents your steps

Witch Survey

Analysis

Single Season Occupancy Model

Summarize Results

-: Manual Workflow

Steps

  1. Move data into Excel
  2. Create summary tables and plots
  3. Cut/paste into Word doc
  4. Reformat to match document

A funny image downplaying on our fears of AI by showing a mistake in Excel

https://www.reddit.com/r/ProgrammerHumor/comments/fiw1rw/excel/

Summarize Results: Manual Workflow

Limitations

Witch Survey

Results

Witch Survey Results

Occupancy


# Load site data and scale them
load("./data/rdata/unmarked_df.Rdata")

sc <- read.csv("./data/csv/sites.csv") |>
    dplyr::select(forest, water) |>
    scale()

# Fit single season occupancy model
mod <- fit_model(unmarked_df)

# Calculate predicted values
pred <- predict_occ(mod, sc)

# Plot predicted values (psi)
ggplot(pred, aes(x = covariateValue, 
                 y = Predicted), 
  group = covariate) + 
  geom_line() +
  geom_ribbon(aes(ymin = lower, 
                  ymax = upper), 
              linetype = 2, 
              alpha = 0.1) +
  xlab("Distance (m)") +
  ylab("Psi") +
  theme_fws() +
  facet_grid(~covariate, scales = "free")

 

Witch Survey Results

Witch Survey Results

Detection



# Plot predicted values (detection)
ggplot(pred, aes(x = covariateValue, 
                 y = Predicted)) +
         geom_line() +
         geom_ribbon(aes(ymin = lower, 
                         ymax = upper), 
                     linetype = 2, 
                     alpha = 0.1) +
         xlab("Distance (m)") +
         ylab("Detection (p)") +
         theme_fws()

Witch Survey Results

Report




Criteria for Best Practice

  • Easy to update
  • Clear link between the data and the report
  • Reproducible

Witch Survey

Report

Witch Survey

Preserve